﻿using ABB_last_end.module;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace ABB_last_end
{
    public partial class Administrator : Form
    {
        public Administrator()
        {
            InitializeComponent();
            this.Text=("权限：管理员");
        }

        //实例化连接类  静态对象    全局访问权限 
        static ABB_connect aBB_Connect = new ABB_connect();

        // 删除窗口  释放线程资源
        private void Administrator_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            this.Close();
        }

        /// <summary>
        ///  机器人触发事件 操作   ui交互   权限：管理员
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region

        //点击连接当前  lsv 中的控制  并登陆 
        private void lsV_adm_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            aBB_Connect.connect_click_connect_adm();
        }

        // 获取所有信号的值
        private void But_Get_io_Click(object sender, EventArgs e)
        {
            aBB_Connect.Get_singnal_all();
        }

        //清空 显示框 信号的值 和 lisvem的值
        private void But_clear_io_Click(object sender, EventArgs e)
        {
            Lsv_io.Items.Clear();
            Lab_io.Text = "io值为：";
        }

        //设置 io名称 信号的值为 1
        private void But_set_1_Click(object sender, EventArgs e)
        {
            aBB_Connect.Set_io_0();
        }

        //设置 io名称 信号的值为 1
        private void But_set_0_Click(object sender, EventArgs e)
        {
            aBB_Connect.Set_io_1();
        }

        // 获取系统配置信息
        private void But_Get_sy_Click(object sender, EventArgs e)
        {
            aBB_Connect.Get_adm_sy();
        }

        // 清空 系统配置信息
        private void But_empty_sy_Click(object sender, EventArgs e)
        {
            teB_sy_info.Clear();
        }

        // 获取控制器运行 信息
        private void But_Get_run_Click(object sender, EventArgs e)
        {
            aBB_Connect.Get_adm_run();
        }

        // 清空 控制器运行 信息 
        private void But_empty_run_Click(object sender, EventArgs e)
        {
            teb_run_time.Clear();
        }

        //切换操作员模式
        private void But_opr_Click(object sender, EventArgs e)
        {
            this.Hide();
            aBB_Connect.connect_refresh();
        }

        //控制器备份
        private void But_save_adm_Click(object sender, EventArgs e)
        {
            aBB_Connect.Save_amd();
        }

        // 控制器重启
        private void But_restart_amd_Click(object sender, EventArgs e)
        {
            aBB_Connect.Restart_amd();
        }

        //控制器mod模块备份
        private void But_mod_save_Click(object sender, EventArgs e)
        {
            aBB_Connect.Seed_adm_File_Pc();
        }

        //控制器mod模块下载
        private void But_amd_download_Click(object sender, EventArgs e)
        {
            aBB_Connect.Seed_adm_robot();
        }


        #endregion

    }
}
